﻿<UserControl x:Class="BillTemplatesControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
             DataContext="{Binding RelativeSource={RelativeSource Self}}"
             xmlns:lib="clr-namespace:HMSLibrary;assembly=HMSLibrary"
             xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit">
    <Grid>
        <Grid Name="MainGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="28"/>
                <RowDefinition Height="28"/>
                <RowDefinition Height="400"/>
            </Grid.RowDefinitions>
            <TextBlock Text="Template Name:" Style="{StaticResource TextBlockStyle}"/>
            <extToolkit:WatermarkTextBox Grid.Column="1" Watermark="Template name" Name="NameTextBox" Margin="2"/>
            <TextBlock Text="Description:" Style="{StaticResource TextBlockStyle}" Grid.Row="1"/>
            <extToolkit:WatermarkTextBox Grid.Column="1" Watermark="Description" Grid.Row="1" Name="DescriptionTextBox" Margin="2"/>
            <my:DataGrid Grid.Row="2" Grid.ColumnSpan="2" AutoGenerateColumns="False" Margin="5" Name="TemplateDataGrid" Visibility="Visible">
                <my:DataGrid.Columns>
                    <my:DataGridTemplateColumn Header="Item Name" Width="300">
                        <my:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ItemName, Mode=TwoWay}"/>
                            </DataTemplate>
                        </my:DataGridTemplateColumn.CellTemplate>
                        <my:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <TextBox Name="ItemNameTextBox" Text="{Binding ItemName, Mode=TwoWay}" KeyUp="ItemNameTextBox_KeyUp"/>
                            </DataTemplate>
                        </my:DataGridTemplateColumn.CellEditingTemplate>
                    </my:DataGridTemplateColumn>
                    <my:DataGridTextColumn Header="Order No" Width="80" Binding="{Binding ItemOrder}" />
                </my:DataGrid.Columns>
            </my:DataGrid>
        </Grid>
        <StackPanel Name="FindStackPanel" Visibility="Collapsed">
            <lib:SearchBox x:Name="Ctrl" HorizontalAlignment="Right" Margin="10,5"
					Width="249" Height="22" Mode="{Binding SelectedValue.Content, ElementName=SearchMode}"
					Prompt="Search text" ToolTip="Type to search the current view">
                <lib:SearchBox.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Option 1" IsCheckable="True"/>
                        <MenuItem Header="Option 2" IsCheckable="True"/>
                    </ContextMenu>
                </lib:SearchBox.ContextMenu>
                <lib:SearchBox.LayoutTransform>
                    <ScaleTransform ScaleX="{Binding Value, ElementName=Scaler}" ScaleY="{Binding Value, ElementName=Scaler}"/>
                </lib:SearchBox.LayoutTransform>
            </lib:SearchBox>
            <extToolkit:BusyIndicator Name="BusyIndicator1" Grid.ColumnSpan="3"/>
            <ScrollViewer Margin="5" MaxHeight="250">
                <my:DataGrid Grid.Row="2" Name="SearchDataGrid" Style="{StaticResource SerachDataGridStyle}">
                    <my:DataGrid.Columns>
                        <my:DataGridTemplateColumn Width="20">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Template="{StaticResource DeleteButtonTemp}" Name="DeleteButton" Click="DeleteButton_Click"/>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTextColumn Header="Template Name" Width="200" Binding="{Binding Name}" IsReadOnly="True"/>
                    </my:DataGrid.Columns>
                </my:DataGrid>
            </ScrollViewer>
        </StackPanel>
    </Grid>
</UserControl>
